﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;

namespace RTW.Web.Comm
{
    public static class GlobalParams
    {
        /// <summary>
        /// 获取指定节点的值
        /// </summary>
        /// <param name="nodeName">节点名称</param>
        /// <returns></returns>
        public static string GetNodes(string nodeName)
        { 
           
            string xmlpath = Path.Combine(AppContext.BaseDirectory + "config.xml");
            XmlDocument xd = new XmlDocument();
            xd.Load(xmlpath);

            XmlNode root = xd.DocumentElement;//获取根节点
            XmlNodeList items = root.ChildNodes;//获取节点类表
            string str = "";
            foreach (XmlNode item in items)
            {
                if (item.Name == nodeName)
                {
                    str = item.InnerText;
                    break;
                }
            }
            return str;
        }

        public static string xmlpath { get; set; }

    }
}
